package com.snopy.order.service.center;

import com.snopy.pojo.JSONResult;
import com.snopy.pojo.PagedGridResult;
import com.snopy.order.pojo.Orders;
import com.snopy.order.pojo.vo.OrderStatusCountsVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;


/**
 * @author snopy
 * @version 1.0.0
 * @classname MyOrdersService
 * @description
 * @email 77912204@qq.com
 * @date 2020/10/13 7:03
 */
@FeignClient("snopy-order-service")
@RequestMapping("my-order-api")
public interface MyOrdersService {

    /**
     * 查询用户订单数
     * @param userId
     * @return
     */
    @GetMapping("getOrderStatusCounts")
    public OrderStatusCountsVO getOrderStatusCounts(@RequestParam("userId") String userId);

    /**
     * 查询我的订单列表
     * @param userId
     * @param orderStatus
     * @param page
     * @param pageSize
     * @return
     */
    @GetMapping("queryMyOrders")
    public PagedGridResult queryMyOrders(@RequestParam("userId") String userId,
                                         @RequestParam(value = "orderStatus",required = false) Integer orderStatus,
                                         @RequestParam(value = "page",required = false) Integer page,
                                         @RequestParam(value = "pageSize",required = false) Integer pageSize);
    /**
     * 查询我的订单
     *
     * @param userId
     * @param orderId
     * @return
     */
    @GetMapping("queryMyOrder")
    public Orders queryMyOrder(@RequestParam("userId") String userId,
                               @RequestParam("orderId") String orderId);
    /**
     * @Description: 订单状态 --> 商家发货
     */
    @PostMapping("updateDeliverOrderStatus")
    public void updateDeliverOrderStatus(@RequestParam("orderId")String orderId);

    @PostMapping("updateReceiveOrderStatus")
    public boolean updateReceiveOrderStatus(@RequestParam("orderId")String orderId);
    /**
     * 删除订单（逻辑删除）
     * @param userId
     * @param orderId
     * @return
     */
    @PostMapping("deleteOrder")
    public boolean deleteOrder(@RequestParam("userId") String userId,
                               @RequestParam("orderId") String orderId);

    /**
     * 获得分页的订单动向
     * @param userId
     * @param page
     * @param pageSize
     * @return
     */
    @GetMapping("getOrdersTrend")
    public PagedGridResult getOrdersTrend(@RequestParam("userId")String userId,
                                          @RequestParam(value = "page",required = false) Integer page,
                                          @RequestParam(value = "pageSize",required = false) Integer pageSize);
    @GetMapping("checkUserOrder")
    public JSONResult checkUserOrder(@RequestParam("userId") String userId,
                                     @RequestParam("orderId") String orderId);
}
